/**
 * Copyright (C) 2010 DustedPixels.com
 */
package com.dustedpixels.cirt.model.machine.spectrum.ula;

import com.dustedpixels.cirt.model.core.Circuit;
import com.dustedpixels.cirt.model.core.Out;
import com.dustedpixels.cirt.model.core.Script;

/**
 * FakeBorderControl
 *
 * @author Michal Pociecha-Los (micapolos@gmail.com)
 */
@Circuit
public final class FakeBorderColorControl {
  @Out public int color = 2;
  
  private int counter;
  
  @Script
  public void update() {
    if (counter == 0) {
      counter = 448 * 12 - 30;
      color = color ^ 0x07;
    }

    counter--;
  }
}
